package com.ten_4_4.hiring.talent.dao;

import java.util.List;

import com.ten_4_4.hiring.comm.util.DBUtil;
import com.ten_4_4.hiring.talent.po.ResumePo;

public class ResumeDao {

	public List<ResumePo> listAllResume(int talentId) {
		String sql = "SELECT * FROM resume WHERE talent_id= ? ";
		return DBUtil.executeQuery(ResumePo.class, sql, talentId);
	}

	public int delete(int resumeId) {
		String sql = "DELETE FROM resume WHERE id = ?";
		return DBUtil.executeUpdate(sql, resumeId);
	}

	public ResumePo getResumePoById(int resumeId) {
		String sql = "SELECT * FROM resume WHERE id = ?";
		return DBUtil.getUniqueResult(ResumePo.class, sql, resumeId);
	}

	public List<ResumePo> list(int talentId) {
		return null;
	}

	public List<ResumePo> getAllResumeListByTalent(int talentId) {
		String sql = "select * from resume where talent_id = ? ";
		return DBUtil.executeQuery(ResumePo.class, sql, talentId);
	}

	public int addResume(List<Object> list) {
		String sql = "insert into resume values(null, ?, ?, ?, ?, ?, ?) ";
		return DBUtil.executeUpdate(sql, list);
	}

	public int modifyIntention(int resumeId, String intention, int expectMinSalary, int expectMaxSalary) {
		String sql = "update resume set intention = ?, expect_min_salary = ?, expect_max_salary = ? where id = ? ";
		return DBUtil.executeUpdate(sql, intention, expectMinSalary, expectMaxSalary, resumeId);
	}

	public int modifyWorkExperience(int resumeId, String workExperience) {
		String sql = "update resume set work_experience = ? where id = ? ";
		return DBUtil.executeUpdate(sql, workExperience, resumeId);
	}

	public int modifyProjectExperience(int resumeId, String projectExperience) {
		String sql = "update resume set project_experience = ? where id = ? ";
		return DBUtil.executeUpdate(sql, projectExperience, resumeId);
	}

	public int modifyEducation(int talentId, int education) {
		String sql = "update talent set education = ? where id = ? ";
		return DBUtil.executeUpdate(sql, education, talentId);
	}

}
